<%@page contentType="text/html;charset=UTF-8"%>
<%@include file="../common.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Project Infor</title>
	<link href="${ctx}/resources/css/project/project.css" rel="stylesheet">
	<link href="${ctx}/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
	<link href="${ctx}/resources/css/bootstrap/bootstrap.min.css" rel="stylesheet">
    <script src="${ctx}/resources/js/jquery/jquery-1.12.0.min.js"></script>
    <script src="${ctx}/resources/js/bootstrap/bootstrap.min.js"></script>
	<c:set var="active" value="settings"/>
    <%@include file="../common/head.jsp"%>
</head>
<body>

<div class="p10 bg-fff">
    <div class="ant-breadcrumb">
            <span>
                <span class="ant-breadcrumb-link">首页</span>
                <span class="ant-breadcrumb-separator">/</span>
            </span>
            <span>
                <a class="ant-breadcrumb-link" href="${ctx}/project/list">项目列表</a>
                <span class="ant-breadcrumb-separator">/</span>
            </span>
            <span >
                <span class="ant-breadcrumb-link">${project.projName}</span>
                <span class="ant-breadcrumb-separator" >/</span>
            </span>
    </div>
</div>

<div class="container p20">
		<div class="row bg-fff">
	    <%--<%@include file="nav.jsp"%>--%>
		<div class="col-md-10">
			<form accept-charset="UTF-8" action="${ctx}/project/save" class="form-horizontal" id="edit_project" method="post">
				<div style="display:none">
				<input name="id" type="hidden" value="${project.id}">
				<input name="totalCommitsCount" type="hidden" value="${project.totalCommitsCount}">
				<input id="autoBuild" name="autoBuild" type="hidden" value="${project.autoBuild}">
				</div>
				<fieldset>
				<legend>项目配置</legend>
				<div class="form-group">
					<label class="control-label" for="projName">项目名称</label>
					<div class="col-sm-10">
						<input class="form-control" id="projName" name="projName" type="text" <%-- readonly="readonly" --%> required value="${project.projName}">
						<div class="light">当代码提交时，项目名称会自动更新</div>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label" for="homePage">项目地址</label>
					<div class="col-sm-10">
						<input class="form-control" id="homePage" name="homePage" type="text"  value="${project.homePage}">
						<div class="light">项目主页</div>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label" for="gitSshUrl">GIT地址</label>
					<div class="col-sm-10">
						<input class="form-control" id="gitSshUrl" name="gitSshUrl" type="text" value="${project.gitSshUrl}">
						<div class="light">案例：git@xxxx/xxx.git</div>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label" for="localDir">本地目录</label>
					<div class="col-sm-10">
						<input class="form-control" id="localDir" name="localDir" type="text" value="${project.localDir}">
						<div class="light">例如：/data/project/xxx</div>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label" for="remoteDir">远程目录</label>
					<div class="col-sm-10">
						<input class="form-control" id="remoteDir" name="remoteDir" type="text" value="${project.remoteDir}">
						<div class="light">例如：/data/web/xxxx</div>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label" for="remoteDir">描述</label>
					<div class="col-sm-10">
						<textarea class="form-control" id="projDesc" name="projDesc" rows="4">${project.projDesc}</textarea>
					</div>
				</div>
				</fieldset>
			<fieldset>
			<%--<legend>Server settings</legend>--%>
				<%--<div class="form-group">--%>
					<%--<label class="control-label" for="testServer">test environment</label>--%>
					<%--<div class="col-sm-10">--%>
						<%--<select multiple class="form-control" id="testServer" name="testServer">--%>
						 <%--<c:forEach items="${testServers}" var="server" varStatus="serverStatus">--%>
						 	<%--<option value="${server.id}">${server.serverName}(${server.ip})</option>--%>
						 <%--</c:forEach>--%>
					    <%--</select>--%>
						<%--<div class="light">test environment servers</div>--%>
					<%--</div>--%>
				<%--</div>--%>
				<%--<div class="form-group">--%>
					<%--<label class="control-label" for="productServer">production environment</label>--%>
					<%--<div class="col-sm-10">--%>
						<%--<select multiple class="form-control" id="productServer" name="productServer">--%>
						 <%--<c:forEach items="${productServers}" var="server" varStatus="serverStatus">--%>
						 	<%--<option value="${server.id}">${server.serverName}(${server.ip})</option>--%>
						 <%--</c:forEach>--%>
					     <%--</select>--%>
						<%--<div class="light">production environment servers</div>--%>
					<%--</div>--%>
				<%--</div>--%>
			<%--</fieldset>--%>
			<%----%>
			<%--<fieldset>--%>
			<%--<legend>Advanced settings</legend>--%>
			<%--<div class="form-group">--%>
				<%--<label class="control-label" for="project_default_ref">Make tabs for the following branches</label>--%>
				<%--<div class="col-sm-10">--%>
					<%--<input class="form-control" id="project_default_ref" name="project[default_ref]" placeholder="master, stable" type="text" value="master">--%>
					<%--<div class="light">You will be able to filter builds by the following branches</div>--%>
				<%--</div>--%>
			<%--</div>--%>
			<%--<div class="form-group">--%>
				<%--<label class="control-label" for="project_public">Public mode</label>--%>
				<%--<div class="col-sm-10">--%>
					<%--<div class="checkbox">--%>
						<%--<label for="project_public"><input name="project[public]" type="hidden" value="0"><input id="project_public" name="project[public]" type="checkbox" value="1">--%>
							<%--<span class="light">Anyone can see project and builds</span>--%>
						<%--</label>--%>
					<%--</div>--%>
				<%--</div>--%>
			<%--</div>--%>
			<%----%>
			<%--<div class="form-group">--%>
				<%--<label class="control-label" for="buildTask">build task</label>--%>
				<%--<div class="col-sm-10">--%>
					<%--<div class="input-group">--%>
						<%--<span class="input-group-addon"></span>--%>
						<%--<input class="form-control" id="buildTask" name="buildTask" placeholder="" type="text" value="${project.buildTask}">--%>
					<%--</div>--%>
					<%--<div class="light">We will use this regular expression to find test coverage output in build trace. Leave blank if you want to disable this feature</div>--%>
				<%--</div>--%>
			<%--</div>--%>
			<%----%>
			<%--<div class="form-group">--%>
				<%--<label class="control-label" for="testTask">Test task</label>--%>
				<%--<div class="col-sm-10">--%>
					<%--<div class="input-group">--%>
						<%--<span class="input-group-addon"></span>--%>
						<%--<input class="form-control" id="testTask" name="testTask" placeholder="" type="text" value="${project.testTask}">--%>
					<%--</div>--%>
					<%--<div class="light">We will use this regular expression to find test coverage output in build trace. Leave blank if you want to disable this feature</div>--%>
				<%--</div>--%>
			<%--</div>--%>
			<%----%>
			<%--<div class="form-group">--%>
				<%--<label class="control-label" for="deployTask">deploy task</label>--%>
				<%--<div class="col-sm-10">--%>
					<%--<div class="input-group">--%>
						<%--<span class="input-group-addon"></span>--%>
						<%--<input class="form-control" id="deployTask" name="deployTask" placeholder="" type="text" value="${project.deployTask}">--%>
					<%--</div>--%>
					<%--<div class="light">We will use this regular expression to find test coverage output in build trace. Leave blank if you want to disable this feature</div>--%>
				<%--</div>--%>
			<%--</div>--%>
			<div class="form-group">
				<label class="control-label" for="script">脚本</label>
				<div class="col-sm-10">
					<div class="input-group">
						<span class="input-group-addon"></span>
						<textarea class="form-control" id="script" name="script" rows="20">${project.script}</textarea>
					</div>
					<%--<div class="light">请在脚本中增加env.abort_on_prompts=True属性；</div>--%>
					<%----%>
					  <%--<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#var-collapse">系统变量</button>--%>
					  <%--<div id="var-collapse" class="collapse">--%>
						<%--<pre>--%>
<%--\${projectPath}--%>
<%--\${projectName}--%>
<%--\${gitUrl}--%>
<%--\${hosts}--%>
<%--\${passwords}--%>
<%--\${remoteDir}--%>
<%--\${commitName}--%>
<%--\${commitShortName}--%>
<%--\${commitDate}--%>
<%--\${commitDateTime}--%>
<%--\${commitTime}	--%>
						<%--</pre>--%>
					  <%--</div>--%>
					  <%--<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#host-collapse">Host说明</button>--%>
					  <%--<div id="host-collapse" class="collapse">--%>
						<%--<pre>--%>
<%--env.hosts=[\${hosts}]--%>
<%--env.passwords = {\${passwords}}--%>
						<%--</pre>--%>
					  <%--</div>--%>
				<%--</div>--%>
			</div>
			</fieldset>
				<div class="form-actions">
					<input class="btn btn-save btn-sm" name="commit" type="submit" value="保存">
					<a class="btn  btn-sm" href="${ctx}/project/list">返回</a>
				</div>
			</form>
		</div>
</div>
</div>
<script language="javascript">
	
	function changeBuild(obj){
		if(obj.checked){
			$("#autoBuild").val(1);
		}else{
			$("#autoBuild").val(0);
		}
	}
	
	function selectServer(id,type){
		if(type=='test'){
			$("#testServer").find("option[value='"+id+"']").attr("selected",true);
		}else{
			$("#productServer").find("option[value='"+id+"']").attr("selected",true);
		}
	}
	<c:forEach items="${project.productServers}" var="server" varStatus="serverStatus">
		selectServer(${server.id},'product');
	</c:forEach>
	
	<c:forEach items="${project.testServers}" var="server" varStatus="serverStatus">
		selectServer(${server.id},'test');
	</c:forEach>
	
	
	
</script>
</body>
</html>
